﻿/*==============================================================
 * ArticleCateMapping.cs
 * Copyright (C) 2014 贵州惠众互联 Inc. All rights reserved.
 *==============================================================
 * Author:   罗应红
 * Date:     2014/02/28 16:01:14.
 * Version:  1.0
 * QQ:		 88962800
*==============================================================*/

using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using QDT.Core.Domain;

namespace QDT.Core.MSData.Mapping {
    public class ArticleCateMapping:EntityTypeConfiguration<ArticleCate> {
        public ArticleCateMapping() {
            HasKey(o => o.ID);
            Property(o => o.ParentId).HasColumnName("pid");
            HasOptional(o => o.Parent).WithMany(o => o.Child).HasForeignKey(o => o.ParentId);
            Property(o => o.ID).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            Property(o => o.InnerArticleTypeId).HasColumnName("type_id");
            Ignore(o=>o.TypeId);
            Property(o => o.IsDelete).HasColumnName("is_delete");
            Property(o => o.IsEffect).HasColumnName("is_effect");
            ToTable(DB.TPref("article_cate"));
        }
    }
}